package com.three.storemanage.feign;

import com.three.core.entity.User;
import com.three.core.vo.R;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @FileName: UserFeignFallbackFactory
 * @Description:
 * @Author: GYX
 * @CreateTime: 2025/3/13 16:51
 * @Version: 1.0.0
 */
@Component
public class UserFeignFallbackFactory implements FallbackFactory<UserFeign> {

    @Override
    public UserFeign create(Throwable cause) {
        return new UserFeign() {
            @Override
            public R<User> getinfo(HttpServletRequest request) {
                return new R<User>(500,"服务器故障",null);
            }

            @Override
            public R<User> getByName(@RequestParam String userName) {
                return new R<User>(500,"服务器故障",null);
            }
        };
    }
}
